package com.cylise.coolweather;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;

import com.cylise.coolweather.db.Country;
import com.cylise.coolweather.db.Province;
import com.cylise.coolweather.service.AutoUpdateService;
import com.cylise.coolweather.util.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;
import org.litepal.crud.DataSupport;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

import static org.litepal.crud.DataSupport.findAll;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        SharedPreferences sharedPreferences = getSharedPreferences("weather",MODE_PRIVATE);
        String weatherId = sharedPreferences.getString("weatherId","");

        if ( !weatherId.isEmpty()){
            Intent intent = new Intent(MainActivity.this,WeatherActivity.class);
            intent.putExtra("weatherId",weatherId);
            startActivity(intent);
            Log.d("sendbroad","startActivity");
        }


        finish();

    }
}
